package com.xbts.screen.monitor.controller;

import com.xbts.common.core.web.controller.BaseController;
import com.xbts.common.core.web.domain.AjaxResult;
import com.xbts.common.log.annotation.Log;
import com.xbts.common.log.enums.BusinessType;
import com.xbts.common.security.annotation.RequiresPermissions;
import com.xbts.screen.monitor.domain.WeMonitorConnectConfig;
import com.xbts.screen.monitor.service.IWeMonitorConnectConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 监控设备连接配置Controller
 * 
 * @author xbts
 * @date 2024-09-05
 */
@Api(tags = "监控设备连接配置管理")
@RestController
@RequestMapping("/monitor/config")
public class WeMonitorConnectConfigController extends BaseController {

    @Autowired
    private IWeMonitorConnectConfigService weMonitorConnectConfigService;

    /**
     * 获取监控设备连接配置详细信息
     */
    @ApiOperation("获取监控设备连接配置详细")
    @RequiresPermissions("monitor:config:query")
    @GetMapping(value = "/details")
    public AjaxResult getInfo() {
        return success(weMonitorConnectConfigService.list().get(0));
    }

    /**
     * 修改监控设备连接配置
     */
    @ApiOperation("更新监控设备连接配置")
    @RequiresPermissions("monitor:config:edit")
    @Log(title = "监控设备连接配置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WeMonitorConnectConfig weMonitorConnectConfig) {
        return toAjax(weMonitorConnectConfigService.updateById(weMonitorConnectConfig));
    }
}
